import { constantRoutes } from '@/router'

const state = {
    menuList: [...constantRoutes],
    sidebarmenu: JSON.parse(localStorage.getItem('sidebarmenu')) || [],
}
const mutations = {
    SET_MMENULIST(state, payload) {
        state.menuList = [...constantRoutes, ...payload]
    },
    SIDEBAR_MENU(state, payload) {
        const list = state.menuList.filter(item => item.type == payload)
        localStorage.setItem('sidebarmenu', JSON.stringify(list))
        state.sidebarmenu = list
    },
}

export default {
    namespaced: true,
    state,
    mutations
}